import cv2
import numpy as np

#创建一张图片
img = np.zeros((200,200),np.uint8)
img1 = np.zeros((200,200),np.uint8)

img[20:120,20:120] = 255
img1[80:180,80:180] = 255

cv2.imshow('img',img)
cv2.imshow('img1',img1)
#new_img = bitwise_not(img)  #图像非运算
#new_img = cv2.bitwise_and(img,img1)  #图像与运算
#new_img = cv2.bitwise_or(img,img1)  #图像或运算
new_img = cv2.bitwise_xor(img,img1)  #图像异或运算

cv2.imshow('new_img',new_img)
cv2.waitKey(0)





